home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-09 | 3.8 KB | 88 lines | [TEXT/GEOL] |
- Item 7275082 8-March-90 07:22PST
-
- From: POWERUP.DEV Power Up Software,PRT
-
- To: MACAPP.TECH$ MacApp Technical
- WILSON6 Wilson, Dave-Personal Concepts,VCA
-
- Sub: Re- Model/View
-
- Attn: MacApp.Tech$
- Attn: Wilson, Dave-Personal Concepts
- SentBy: James Plamondon
- Date 3/6/90
- Subject Re- Model/View
- From James Plamondon
- To Wilson, Dave-Personal Concepts
- CC MacApp.Tech$
-
- Reply to: Re- Model/View
- Dave,
-
- Thanks for your response. Your suggestion hits pretty close to what I have in
- mind. I'll stick with your example in the following discussion.
-
- Let's assume that I have some kind of global dependency dictionary, and that
- in this dictionary two objects, Invoice and Summary (of classes
- TCustomerInvoiceView and TCustomerSummaryView, respectively) are noted as
- being dependent on an object (Customer) of class TCustomer. (Thus, to use my
- terminology, Invoice and Summary are dependents of Customer, and Customer is a
- supporter of Invoice and Summary.)
-
- Let's further assume that the following methods have been added to TObject:
- PROCEDURE TObject.SupporterChanged(
- theSupporter: TObject;
- theChange: LONGINT;
- theContext: Univ Handle);
- { This method advises SELF that one of the objects it depends on,
- theSupporter, has
- changed. theChange is an indication of the kind of change (a la
- itsChoice in
- DoChoice()), while theContext contains whatever information is
- appropriate to
- a change of the kind indicated by theChange. }
-
- PROCEDURE TObject.NotifyDependents(
- theChange: LONGINT;
- theContext: Univ Handle);
- { This method advises SELF that it should notify its dependents that
- it has changed in
- some important way. The nature of the change is indicated by
- theChange, and
- theContext includes whatever additional information is necessary
- for changes of that
- kind. This routine will send each of its dependents the message
- SupporterChanged(SELF, theChange, theContext). }
-
- All of the Set<some field>() routines in TCustomer end with a call to
- TCustomer.NotifyDependents(<some value>, NIL). This routine uses a CASE
- statement (yuck!) on theChange to fill out theContext as needed, and then
- calls INHERITED NotifyDependents(theChange, theContext), which in turn sends
- SupporterChanged() messages to each of the TCustomer's dependents.
-
- Each class that cares about SupporterChanged() messages will have to override
- SupporterChanged(), to take appropriate action. This will again require a
- CASE statement on theChange, to find out what happened to theSupporter (and
- how to decipher theContext).
-
- This all seems like an exceedingly non-object-oriented way of doing things — I
- mean, it uses CASE statements, for Eiffel's sake (whoops — sorry; didn't mean
- to get religious on you). It has been suggested that instead of passing an
- identifier and a handle, one could pass a class ID and a object handle — and
- assume that the object was of some subclass of a new class called TMessage.
- Then, you could call polymorphic methods on the given TMessage object (which
- would actually be an object belonging to a sub-class of TMessage). That is
- supposed to help somehow, but I'm not entirely clear on how it would help.
-
- So — the question! Do you (or anybody else out there) have an object-oriented
- way of implementing change propagation, which does NOT violate the Rule of
- Model/View Separation — or can they explain to me how a TMessage class helps
- in change propagation?
-
- Looking forward to your responses, I remain,
-
- Yours,
-
- James Plamondon
-
-